#include <stdio.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <termios.h>

//#define _test_
struct WINSIZE{
	unsigned short ws_row;
	unsigned short ws_col;
	unsigned short ws_xpixel;
	unsigned short ws_ypixel;
};

static struct WINSIZE winsize;

int getRow(void){
	return winsize.ws_row;
}

int getCol(void){
	return winsize.ws_col;
}

void sizeRefresh(void){
	ioctl(STDIN_FILENO, TIOCGWINSZ, &winsize);
}

#ifdef _test_
int main(void){

	sizeRefresh();
	printf("row:%d\ncol:%d\n", getRow(), getCol());
	return 0;
}

#endif


